Skip to content

Feature/leg animations clean#164

Merged
danic85 merged 13 commits into
developfrom
feature/leg_animations_clean
Apr 25, 2026
Merged

Feature/leg animations clean#164
danic85 merged 13 commits into
developfrom
feature/leg_animations_clean

Conversation

@danic85

@danic85 danic85 commented Apr 23, 2026

Copy link
Copy Markdown
Collaborator

What type of change is this?

  • New module
  • Change to an existing module
  • Core improvement
  • Other (please describe)

📝 What does this change do?

This PR introduces a startup lifecycle hook (on_load) and expands the “Personality” module to support pose animations driven by knee-position pose estimation and basic “being carried” detection, alongside some servo/IMU utility additions and updated Cody environment configuration.

Changes:

Add a module lifecycle hook (on_load) invoked after dependency injection, and call it from main.py.
Extend Personality with pose animation queueing, knee-based pose estimation, and carried detection; adjust default behavior flags and tests.
Improve actuator/IMU utilities (servo move_degrees speed override + computed range_degrees; BNO055 acceleration accessors) and update Cody config + CI workflow.

❓ Why is this change needed?

🛠️ How was this implemented?

🧪 How was this tested?

💥 Breaking changes

  • Yes (please describe)
  • No

🗂 Related issues

✅ PR Checklist

  • Title & Description: PR title and description are clear and complete.
  • Documentation: PR links to idea in github discussion group containing complete documentation.
  • Scope & Size: PR is focused on a single issue/feature and is a reasonable size.
  • Code Quality: Code is clean, consistent, and follows the project style guide.
  • Tests: Tests have been added/updated if needed.
  • Manual Testing: Changes have been tested on the latest release of the project.
  • Self-Review: I’ve reviewed my own code and ensured there are no obvious issues.

🚀 Thank you for your contribution to the project!

@danic85 danic85 changed the base branch from main to develop April 23, 2026 18:43
@danic85

danic85 commented Apr 23, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot the neck_tilt in personality.py track_match() is overshooting since the changes have been made in this branch, can you identify why?

Copilot AI commented Apr 23, 2026

Copy link
Copy Markdown

@copilot the neck_tilt in personality.py track_match() is overshooting since the changes have been made in this branch, can you identify why?

The overshoot was caused by calculate_range_degrees in bus_servo.py always using ST_MAX = 4095 to convert position units to degrees, even for SC-type servos like neck_tilt (SC09) which have a max position of only SC_MAX = 1024.

For neck_tilt with range [30, 200]:

  • Wrong (ST_MAX): range_degrees = 14.95°units_per_degree = 11.38 → ~4× overshoot
  • Correct (SC_MAX): range_degrees = 59.77°units_per_degree = 2.84

Fixed in f239cf9 by making calculate_range_degrees select the correct max value based on servo model prefix (SCSC_MAX=1024, otherwise ST_MAX=4095).

@danic85

danic85 commented Apr 23, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot can you fix the failing unit tests? Do not change the implementation, just adjust the tests to pass.

Copilot AI commented Apr 23, 2026

Copy link
Copy Markdown

@copilot can you fix the failing unit tests? Do not change the implementation, just adjust the tests to pass.

The failing test (test_init_defaults asserting balance_enabled == True) was already fixed in commit 96a80ea — the test now correctly expects False to match the implementation. All 167 tests are passing.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a startup lifecycle hook (on_load) and expands the “Personality” module to support pose animations driven by knee-position pose estimation and basic “being carried” detection, alongside some servo/IMU utility additions and updated Cody environment configuration.

Changes:

  • Add a module lifecycle hook (on_load) invoked after dependency injection, and call it from main.py.
  • Extend Personality with pose animation queueing, knee-based pose estimation, and carried detection; adjust default behavior flags and tests.
  • Improve actuator/IMU utilities (servo move_degrees speed override + computed range_degrees; BNO055 acceleration accessors) and update Cody config + CI workflow.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/modules/sensor/imu/bno055/bno055.py Adds acceleration and linear-acceleration getters used by carried detection.
src/modules/personality/tests/test_personality.py Updates default expectation for balance_enabled.
src/modules/personality/personality.py Adds pose animation logic, knee pose estimation, carried detection, and default flag changes.
src/modules/base_module.py Adds on_load() lifecycle hook to the base module API.
src/modules/actuators/bus_servo/bus_servo.py Computes range_degrees by default; adds speed override to move_degrees; improves pose missing handling and logging.
src/module_loader.py Adds modules_loaded() to invoke on_load() on all modules post-injection.
src/main.py Calls loader.modules_loaded() after dependency injection.
environments/cody.yml Updates servo ranges/speeds and adds personality pose/threshold configuration.
.github/workflows/test.yml Runs install.sh and switches unit test execution to the created venv interpreter.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/test.yml
Comment thread src/modules/actuators/bus_servo/bus_servo.py
Comment thread src/modules/personality/personality.py
Comment thread src/modules/personality/personality.py
Comment thread src/modules/personality/personality.py
Comment thread src/modules/personality/personality.py
Comment thread src/modules/personality/personality.py
@danic85 danic85 merged commit 3c43cb2 into develop Apr 25, 2026
1 check passed
@danic85 danic85 deleted the feature/leg_animations_clean branch April 25, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants